package app.view.actions;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.JComboBox;

import app.model.ticket_reserve.Evento;
import app.view.ViewReservaBilhetes;

public class TrocaDeEventos implements ItemListener{

	private ViewReservaBilhetes view;

	public TrocaDeEventos(ViewReservaBilhetes view) {
		this.view = view;
	}
	
	@Override
	public void itemStateChanged(ItemEvent item) {
		int index = ((JComboBox<Evento>) item.getSource()).getSelectedIndex();
		Evento evento = ((JComboBox<Evento>) item.getSource()).getItemAt(index);
		this.view.setInfoLabels(evento.getData(), evento.getHora());
		this.view.LimparListaDeLugares();
		
		this.view.validate();
		this.view.repaint();
	}

}
